package com.zxjbyte.yiyi.module.system.controller.log;

import com.zxjbyte.yiyi.framework.common.domain.api.PageResult;
import com.zxjbyte.yiyi.framework.common.domain.api.R;
import com.zxjbyte.yiyi.module.system.domain.param.ErrorLogListParam;
import com.zxjbyte.yiyi.module.system.domain.param.ErrorLogProcessParam;
import com.zxjbyte.yiyi.module.system.domain.vo.ErrorLogListVO;
import com.zxjbyte.yiyi.module.system.service.ErrorLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Author zhangxingjia
 * @Date 2023/3/17 17:32
 * @Version: 1.0
 */
@Slf4j
@Tag(name = "异常日志")
@RestController
@RequestMapping(value = "/system/error-log")
public class ErrorLogController {

    @Resource
    private ErrorLogService errorLogService;

    @Operation(summary = "异常日志列表查询")
    @GetMapping("/list")
    public PageResult<ErrorLogListVO> list(@ParameterObject ErrorLogListParam param){
        return errorLogService.list(param);
    }

    @Operation(summary = "处理异常日志")
    @PostMapping("/process")
    public R<?> process(@Valid @RequestBody ErrorLogProcessParam param){
        errorLogService.process(param);
        return R.ok();
    }
}
